//;(function($){
	$(function(){
		$('#formLogin').validate({
			rules:	{
				user_name:	{required: true},
				password:	{required: true}
			},
			submitHandler:	function(form){
				$(form).ajaxBind({}, {
					loading:	$(form),
					type:		'auto',
					onSuccess:	function(data){
						window.location = rootPath + "/successful/" + data.user_id;
					},
					errorMeg:	'User name and password doesn\'t match.'
				});
				return false;
			}
		});
		
		$('#nav').children('li').each(function(){
			if( $(this).hasClass('current') ){
				$(this).addClass('on');
			}
			$(this).click(function(){
				if( ! $(this).hasClass('on') ){
					var subNav = $('#' + $(this).data('sub'));
					$(this).addClass('on').siblings().removeClass('on');
					subNav.addClass('current').siblings().removeClass('current');
					return false;
				}
			});
		});
        
	});

//})(jQuery);